<template>
	<view class="flex-col page">
		<view>
			<view :style="{height:statusBarHeight+'px'}"></view>
			<u-navbar title="帮助中心" bgColor="#F5F5F5" @leftClick="$nav(2)">	
			</u-navbar>
		</view>
		
		
		<view class="category-bg">
			<view class="flex-col justify-center item" v-for="(item,index) in helpCategory" :key="index" @click="itemClick(item)">
				<image :src="item.icon" style="width: 90rpx;height: 90rpx;"></image>
				<text style="margin-top: 25rpx;">{{item.name}}</text>
			</view>
			
		</view>
		
		<view class="help-list" v-for="(li,i) in helpList" :key="i">
			<view class="flex-row justify-between items-center list-item" @click="listClick(li)">
				<text>{{li.title}}</text>
				<u-icon name="arrow-right" size="18"></u-icon>
			</view>
		</view>
		
		
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				helpCategory:[],
				helpList:[]
			};
		},
		onLoad() {
			this.getHelpInfo();
		},
		computed:{
			statusBarHeight(){
				return this.$store.state.statusBarHeight + 44
			}
		},
		methods:{
			itemClick(item){
				uni.navigateTo({
					url:'/pages/mine/help/help_list?title='+item.name+'&id=' + item.help_id
				})
			},
			listClick(item){
				let pack = encodeURIComponent(JSON.stringify(item))
				uni.navigateTo({
					url:'/pages/mine/help/help_detail?obj='+pack
				})
			},
			getHelpInfo(){
				this.$request({
					url:'?c=User&a=help',
					type:'post',
				}).then(res =>{
					// console.log(res)
					this.helpCategory = res.data.help
					this.helpList = res.data.helpShow
				})
			}
		}
	}
</script>

<style lang="scss">
.page{
	width: 100%;
	overflow-y: auto;
	overflow-x: hidden;
	height: 100%;
}
.category-bg{
	display: flex;
	// justify-content: space-between;
	flex-wrap: wrap;
	background-color: #fff;
	padding-top: 30rpx;
	padding-bottom: 30rpx;
}
.item{
	display: flex;
	flex-direction: column;
	align-items: center;
	flex: 0 0 25%;
}
.help-list{
	background-color: #fff;
	margin-top: 10rpx;
	padding: 20rpx 30rpx 20rpx 30rpx;
	
}
.list-item{
	height: 90rpx;
}
</style>
